package kr.saeildamil.androidstudy.ch08;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;

public class HandleEvent03 extends Activity implements View.OnTouchListener{
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		View mv = new View(this);
		mv.setOnTouchListener(this);
		setContentView(mv);
	} // end of oncreate

	public boolean onTouch(View v, MotionEvent event) {
		float x = event.getX();
		float y = event.getY();
		if (event.getAction() == MotionEvent.ACTION_DOWN) { // 눌렀냐는 말임
			Toast.makeText(HandleEvent03.this,
					"Point " + x + ", " + y + "를  Action Down!",
					Toast.LENGTH_LONG).show();
			return true;
		} else if (event.getAction() == MotionEvent.ACTION_UP) {
			Toast.makeText(HandleEvent03.this, "Action Up!",
					Toast.LENGTH_LONG).show();
			return true;
		}

		return false;

	}
}
